<?php
/**
 * 奖品的操作记录
 */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePrizeRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('prize_records', function (Blueprint $table) {
            $table->uuid('id')->unique();
            $table->uuid('prize_id');//奖品id
            $table->uuid('activity_id')->nullable();//活动id
            $table->integer('limit')->default(0);//中奖限制
            $table->integer('number')->default(0);//变化奖品数量
            $table->integer('summary')->default(0);//变化后结果
            $table->integer('probability')->nullable();//中奖概率
            $table->string('operate')->default('entry');//操作entry入库，delivery出库
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('prize_records', function (Blueprint $table) {
            $table->dropIfExists();
        });
    }
}
